package com.qf.springboot.exhandler;

import com.qf.springboot.vo.ResultVo;
import com.qf.springboot.vo.ReturnVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExHandler {
    @ExceptionHandler(ParamBullException.class)
    public ReturnVo handleParamNullEx(ParamBullException e) {
        String msg = e.getMsg();
        return ReturnVo.fail(msg);
    }

    @ExceptionHandler(Exception.class)
    public ResultVo handleEx(Exception e) {
        return ResultVo.fail(e.getMessage());
    }
}
